
		function queryString(str){
			var sValue=location.search.match(new RegExp("[\?\&]"+str+"=([^\&]*)(\&?)","i"));
			return sValue?sValue[1]:sValue;
		}

var name = queryString('name');
var num = queryString('num');

console.log(name+'|'+num);


//var servePath = "";
/*var servePath = "public/";
var basePath = servePath+"img/";*/
var basePath = "../img/mobile/";
var loader = new WxMoment.Loader();
var fileList = ["big-bg.jpg","bgm.mp3", "chen.png","david.png","jia.png","tanneberger.png","vollmer.png","xu.png","zhang1.png","zhang2.png","zhang3.png"];
for (var i = 0; i < fileList.length; i++) {
    loader.addImage(basePath + fileList[i]);
}
for (var i = 1; i <= num; i++) {
    //console.log(basePath + name +'/'+i+'.png');
    loader.addImage(basePath + name +'/'+i+'.png');
}
loader.addProgressListener(function (e) {
    var percent = Math.round((e.completedCount / e.totalCount) * 100);
    $("#loadingbg").show();
    $('#loadingtxt').html(percent + '%');
});
loader.addCompletionListener(function () {
    $("#loadingbg").hide();
    $("#content").show();
    indexbg();
    $('#qianming').attr('src','../img/mobile/'+name+'/1.png').addClass(name);
    $('#nametitle').addClass(name);
});
loader.start();


window.onresize = function(){
    windowWH();
};
//windowWH
function windowWH(){
    var ww = $(window).width();
    var wh =  $(window).height();
    var bghei = 1138;
    var autohei = 838;
    var ftop = (wh - autohei)/2;
    var bgauto1 = -(bghei-wh)/2;
    var bgauto2 = -(bghei-autohei)/2;

    if(ww < wh && wh >= autohei){
        //$(".bgimg").css("top",bgauto1);
        //$(".fix-height").css("top",ftop);
        $("#p1,#p2,#p3,.p2bg").css("height",wh);
        $(".swiper-container").css({height:(wh+1)+"px"});
    }else if(ww < wh && wh < autohei){
        //$(".bgimg").css("top",bgauto2);
        //$(".fix-height").css("top",0);
        $("#content").css({height:autohei+"px"});
        $(".swiper-container").css({height:autohei+"px"});  
    }


}

//popShow
function popShow(){
    $(".pop_one").hide();
    $("#bggray").show();
    $("#pop_window").show();
    $(".onoff").hide();
}
//popHide
function popHide(){
    $(".pop_one").hide();
    $("#bggray").hide();
    $("#pop_window").hide();
    $(".onoff").show();
}
//popDivs







//popOrientLayer
function popOrientLayer(){
    $("#orientLayer-bg").show();
    $(".pop-orientLayer").show();

}
function popOrientLayerHide(){
    $("#orientLayer-bg").hide();
    $(".pop-orientLayer").hide();
    //window.location.reload(true);
}




///////////////////////////////
$(function(){
    windowWH();
    orientationTips(); 
    //playAudio();

    var handler1 = function () {
        $('.sekuai .lun1, .sekuai .lun2').removeClass('zhuang');
        TweenLite.to($("#p1"), 5, {ease:Power0.easeNone, scale: 5, transformOrigin:'333px 782px'});
        TweenLite.to($("#p1 .white"), 2, {opacity: .8, onComplete: handler2});
        
        /*TweenLite.to($("#p1 .white"), 3, {opacity: 1});
        setTimeout(function(){
            $('#p1').hide();
            $('#p2').fadeIn();
            TweenLite.to($(".omg1"), 1, {opacity: 1,  onComplete: handler3});
        }, 2000);*/
    };
    var handler2 = function () {
        $('#p1').fadeOut(2000);
        $('#p2').fadeIn(2000);
        TweenLite.to($(".omg1"), 4, {opacity: .5,  onComplete: handler3});

        setTimeout(function(){
            var qm = $('#qianming');
            qm.gifOn('../img/mobile/'+name+'/',num,{mode:2, speed:'40',repeat:0, onComplete: function(){
                $('#nametitle').attr('src', '../img/mobile/'+name+'.png').fadeIn('1000');
                setTimeout(function(){
                    $('#p2').fadeOut(3000);
                    $('#p3').fadeIn(3000);
                }, 2000);
            }});
        }, 2000);
        setTimeout(function(){
            reset();
        }, 10000);
    };// 
    var handler3 = function () {
        TweenLite.to($(".omg1"), 4, {opacity: 1});
        
    };// 
    




    $('.snow').on('click', function(){
        $('.snow, .tap').hide();
        $('.sekuai .lun1, .sekuai .lun2').addClass('zhuang');
        TweenLite.to($(".bgbb"), 9, { x:2700, onComplete: handler1});
        //$('.xue').show();
        //var qm = $('.xue');
        //qm.gifOn('../img/mobile/xue/',2,{mode:2, speed:'400',repeat:-1});
    })


});

function reset(){
    $('.snow, .tap').show();
    $('.sekuai .lun1, .sekuai .lun2').removeClass('zhuang');
    TweenLite.to($(".bgbb"), 0.01, {ease:Power0.easeNone, x:0});
    TweenLite.to($("#p1"), 0.01, {ease:Power0.easeNone, scale: 1, transformOrigin:'333px 782px'});
    TweenLite.to($("#p1 .white"), 0.01, {opacity: 0});

    TweenLite.to($(".omg1"), 0.01, {opacity: 0});
    $('#qianming').attr('src', '../img/mobile/'+name+'/1.png');
    $('#nametitle').attr('src', '../img/mobile/'+name+'.png').hide();

    setTimeout(function(){
                    $('#p2,#p3').fadeOut(30);
                    $('#p1').fadeIn(30);
    }, 2000);
}


function  indexbg() {

}


function infiniteAnimation() {



    

}





//orientationTips
function orientationTips(){
    if (window.orientation === 90 || window.orientation === -90 ){ 
        popOrientLayer();
    }  
    window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", function() {
        if (window.orientation === 180 || window.orientation === 0) { 
            popOrientLayerHide();
        } 
        if (window.orientation === 90 || window.orientation === -90 ){ 
            popOrientLayer();
        }  
    }, false);
}


